package groovy

def fact
fact={int number,BigInteger thrFact->number==1?thrFact:fact.trampoline(number-1,number*thrFact)}.trampoline()
println("the fact(5) is ${fact(5,1)}")
println("Number of bits in the result is ${fact(5000,1).bitCount()}")